#!/usr/bin/env python
# -*- coding: UTF-8 -*-
# @Project : chat_model 
# @File    : knowledge_file_model.py
# @IDE     : PyCharm 
# @Author  :ZH
# @Time    : 2025/1/10 16:26
from tortoise import fields

from apps.models.base_model import BaseModel
from apps.utils.enumerate import KnowledgeFileStateEnum


class KnowledgeFile(BaseModel):
    __doc__ = "知识库文件配置表"
    user_id = fields.IntField(null=False, description='用户id')
    file_name = fields.CharField(max_length=256, null=False, description='文件名称')
    file_size = fields.IntField(null=False, description='文件大小')
    file_hash = fields.CharField(max_length=256, null=False, description='文件hash')
    file_address = fields.CharField(max_length=256, null=False, description='文件地址')
    knowledge_id = fields.IntField(null=False, description='知识库id')
    state = fields.IntEnumField(KnowledgeFileStateEnum, default=KnowledgeFileStateEnum.waiting, description='状态')
    split_size = fields.IntField(null=True, default=1024, description='分片大小')
    split_str = fields.CharField(max_length=256, null=True, default='\n', description='分片字符串')
    file_extract_id = fields.IntField(null=True, description='文件抽取服务id')

    class Meta:
        table = "knowledge_file"
        table_description = "知识库文件配置表"

